package com.schooldate.model.service.impl;

import com.schooldate.base.BaseSupportImpl;
import com.schooldate.model.entity.MessageBoard;
import com.schooldate.model.service.MessageBoardService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * Created by etund on 2015/3/21 0021.
 */
@Service
@Transactional
@SuppressWarnings("all")
public class MessageBoardServiceImpl extends BaseSupportImpl<MessageBoard> implements MessageBoardService {


    @Override
    public List<MessageBoard> getBySchoolId(Long schoolId, Integer refreshNum) {
        return this.getSession().createQuery(" FROM  MessageBoard mb where mb.userInfo.school.id = ?  order by id*-1")
                        .setParameter(0,Integer.parseInt(schoolId+""))
                        .setMaxResults(refreshNum)
                        .list();
    }
}
